<%@page import="com.alibaba.fastjson.JSONObject"%>
<%@page import="com.alibaba.fastjson.JSONArray"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>

<script type="text/javascript" src="js/jquery-1.11.0.js"></script>

<script type="text/javascript">
	$(function(){
		$(".state_slet").change(function(){
			var state = $(this).val();
			var id = $(this).parents("tr").find(".o_id").text();
			
			$.get("OrderUpdateServlet",{"id":id,"state":state},function(){
				 
			});
			 
		});
	});
</script>
<style type="text/css">
	@IMPORT url("css/core.css");
</style>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<base href="<%=basePath%>"/>
</head>
<body>
	<table>
		<thead>
			<tr>
				<th>订单号</th>
				<th>订单日期</th>
				<th>商品名称</th>
				<th>商品图片</th>
				<th>数量</th>
				<th>订单状态</th>
				<th>订单总价</th>
				<th>收货地址</th>
			</tr>
		</thead>
		<tbody>
	<%
		Object object = request.getAttribute("list");
		if(object != null){
			JSONArray array = (JSONArray)object;
			for(Object obj:array){
				JSONObject jsonObject = (JSONObject)obj;
	%>
			<tr>
				<th class="o_id"><%=jsonObject.getString("oid") %></th>
				<th><%=jsonObject.getString("date") %></th>
				<th><%=jsonObject.getString("gname") %></th>
				<th><img src="<%=jsonObject.getString("gimage") %>"></th>
				<th><%=jsonObject.getString("gnumber") %></th>
				<th>
					<select class="state_slet">
						<option value="1">待发货</option>
						<option value="2">已发货</option>
					</select>
				</th>
				<th><%=jsonObject.getString("price") %></th>
				<th><%=jsonObject.getString("address") %></th>
			</tr>			
	<%
	
			}
		}
	%>
		</tbody>
	</table>
</body>
</html>